package com.example.libraryapp.adapter;

import android.content.Context;

import com.example.libraryapp.R;
import com.example.libraryapp.adapter.base.BaseAdapter;
import com.example.libraryapp.adapter.base.BaseViewHolder;
import com.example.libraryapp.bean.Book;
import com.example.libraryapp.bean.BookType;
import com.example.libraryapp.util.GlideUtil;

/**
 * @author 伍凯铭
 * @since 2020/6/20
 */
public class BookAdapter extends BaseAdapter<Book> {

    public BookAdapter(Context context) {
        super(context);
    }

    @Override
    public void bindData(BaseViewHolder holder, Book data) {
        GlideUtil.loadImage(mContext,data.getPicture(),holder.getImageView(R.id.book_img));
        holder.getTextView(R.id.book_name).setText(data.getBookName());
        holder.getTextView(R.id.book_author).setText(data.getAuthor());
        holder.getTextView(R.id.book_publisher).setText(data.getPublisher());
        holder.itemView.setOnClickListener(holder);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_book;
    }
}
